<div class="xf_ht_ttc" id="xf_ht_fkzh_ttc" style="display:none;">
  <div class="xf_ht_jr_obu_width">
    #{form @SaveSecurity(), id:'adsEnsureEdit'}
    <table border="0" cellspacing="0" cellpadding="0" class="xf_ht_jr_obu_form" width="100%">
      <tr>
        <td align="right" valign="middle" width="130">编号：</td>
        <td>
          <input type="hidden"  name="status" id="status" value="${security?.status}"/>
          <input class="xfht_zr_input" type="text" value="${security?.id}" id="ensureNo" name="ensureId" readonly="readonly"/> 
          <span class="xf_ht_banner_s" id="imageResolution2">${security?.resolution}</span>
          <span class="xf_ht_banner_s" id="imageType2">${security?.fileFormat}</span>
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">标题：</td>
        <td>
          <input class="xfht_zr_input" type="text" value="${security?.title}" id="ensureTitle" name="ensureTitle" />
        </td>
      </tr>
      <tr>
        <td align="right" valign="top">效果图：</td>
        <td>
          <input type="hidden"  name="resolution" id="imageResolutiontTemp"/>
          <input type="hidden"  name="isLinkEnabled" id="isLinkEnabled"/>
          <input type="hidden"  name="type" id="imageTypeTemp"/>
          <input type="hidden" id="filename" name="filename" />
          <span style="position: relative;top: -15px;">
		    <input type='button' class='upload_btn' value='上传'/> 
		    <input type="file" class="upload_file" name="imgFile" id="imgFile" onchange="uploadImage('imgFile','loanImage');" style="position: absolute;
top: 15px;left: -70px;"/>
		  </span>
        </td>
      </tr>
      <tr>
        <td colspan="2" style="text-align: center;">
          #{img src:"${security?.imageFileName}",alt:"",id:"loanImage",class:"xf_ht_banner_simg"}#{/img}
        </td>
      </tr>
      <tr>
        <td align="right" width="110">所在位置：</td>
        <td>
          <input type="hidden" name="ensureLocation" id="ensureLocation" >
          <input class="xf_ht_pro_in_bq" type="text" id="location" value="${security?.location}" disabled="disabled"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="xf_ht_sh_tddiv" style="padding-left: 60px;">
            <input type="checkbox" value="1"
            #{if security?.isLinkEnabled}
            checked="checked"
            #{/if}> 启动超链接，链接地址：<input class="xf_ht_banner_input" type="text" name="url" id="url" value="${security?.url}" />
          </div>
          <div class="xf_ht_sh_tddiv_r" style="padding-left: 230px;padding-top: 10px;">
            <input type="radio" name="target" value="2"
            #{if security.target == 2}
            checked="checked"
            #{/if}
            > 新页打开&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="target" value="1"
            #{if security.target == 1}
            checked="checked"
            #{/if}
            > 本页打开
          </div>
        </td>
      </tr>
    <tr>
      <td align="right">&nbsp;</td>
      <td style="padding:20px 0 40px 0;">
        <input class="xf_ht_tcc_button_ok" type="button" value="确  定" onclick="handle();">
        <input class="xf_ht_tcc_button_on" type="button" value="取  消"  onclick="concel();">
      </td>
    </tr>
  </table>
  #{/form}
  </div>
</div>
<script type="text/javascript">
  function concel(){
    layer.closeAll();
  }
    
  function handle(){
    var patrn=/^([1-9]\d*|0)(\.\d*[1-9])?$/; 
    var loanImage = $("#loanImage").attr("src");
    $("#filename").val(loanImage);
    var location = $("#location").val();
    $("#ensureLocation").val(location);
    var temp = $("#imageType2").text();  
    $("#imageTypeTemp").val(temp);
    var imageResolution = $("#imageResolution2").text();  
    $("#imageResolutiontTemp").val(imageResolution);
    	
    var title = $("#ensureTitle").val();
    if(title.replace(/(^\s*)/, "") =="" || title.replace(/(^\s*)/, "") ==null){
      alert("对不起！标题不能为空！");
      
      return;
    }
    	
    var openHref = $("input[type='checkbox']:checked").val();
    	
    if(openHref > 0){
      if($("#url").val().replace(/(^\s*)/, "") =="" || $("#url").val().replace(/(^\s*)/, "")==null){
        alert("对不起！链接不能为空！");
        
        return;
      }
      
      if($("#url").val().indexOf('http://') !== 0 && $("#url").val().indexOf('https://') !== 0){
      	alert("请填写完整的连接地址；如：http://、https://");
      	
      	return;
      }
      $("#isLinkEnabled").val(1);
    }else{
      $("#isLinkEnabled").val(0);
    }
    	
    if(loanImage =="" || loanImage == null){
      alert("对不起！请上传图片！");
      
      return;
    }
    	
    $("#adsEnsureEdit").submit();
  }
</script>